﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Media;
using System.Windows.Forms;
using System.IO;

namespace WindowsFormsApplication1
{
    public partial class Printing : Form
    {
        private Timer clock;
        public bool done = false;

        public Printing()
        {
            InitializeComponent();

            clock = new Timer();
            clock.Interval = 100;
            clock.Tick += new EventHandler(clock_Tick);
            clock.Start();
        }

        void clock_Tick(object sender, EventArgs e)
        {
            progressBar1.PerformStep();
            progressBar1.Refresh();
           // System.Console.WriteLine("dsf");
         //   textBox1.Text = "" + progressBar1.Value;

            if (progressBar1.Value == 100)
            {
                Show();
                string soundClipLocation = Path.GetDirectoryName(Application.ExecutablePath).Replace("\\bin\\Debug", "\\Sounds\\ding.wav");
                SoundPlayer sp = new SoundPlayer(soundClipLocation);
                sp.Play();


                Close();
                done = true;
            }
        }

        public void sss()
        {
            clock.Start();
        }

        private void Form2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            Close();
        }

        // Handle Closing of the Form.
        protected override void OnClosing(CancelEventArgs e)
        {
            clock.Stop();


            base.OnClosing(e);
        }
    }
}
